#ifndef BASIC_like_std_string_functions
#define BASIC_like_std_string_functions

#include <string>
#include <cctype>

std::string UCASE(std::string s)
{
  if(s.empty())
    return s;
  else
  {
    for(int i = 0; i < s.size(); i++)
    {
      if(s[i] >= 'a' && s[i] <= 'z')
        s[i] = (s[i] - ('a' - 'A'));
    }
  }
  return s;
}

std::string LCASE(std::string s)
{
  if(s.empty())
    return s;
  else
  {
    for(int i = 0; i < s.size(); i++)
    {
      if(s[i] >= 'A' && s[i] <= 'Z')
        s[i] = (s[i] + ('a' - 'A'));
    }
  }
  return s;
}

std::string LTRIM(std::string s)
{
  start:
  if(s.empty())
    return s;
  if(isspace(s[0]))
    s.erase(0,1);
  else
    return s;
  goto start;
}

std::string RTRIM(std::string s)
{
  start:
  if(s.empty())
    return s;
  if(isspace(s[(s.size()-1)]))
    s.erase(s.size()-1, 1);
  else
    return s;
  goto start;
}

std::string TRIM(std::string s)
{
  return LTRIM(RTRIM(s));
}

#endif
